package kr.saeildamil.androidstudy.ch09;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;

public class ChangeMenu extends Activity {
	boolean mBeginer = true;
	private static final String TAG = "LogTest";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch09_changemenu);
		Log.v(TAG, "onCreate");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		Log.v(TAG, "onCreateOptionMenu");
		MenuInflater inflater = getMenuInflater();
		if (mBeginer) {
			Log.v(TAG, "mbeginner" + mBeginer + "초보자모드");
			inflater.inflate(R.menu.beginner, menu);
		} else {
			Log.v(TAG, "mbeginner" + mBeginer + "전문가모드");
			inflater.inflate(R.menu.professional, menu);
		}
		return true;
	}

	public void mOnClick(View v) {
		Log.v(TAG, "mOnClick");
		if (v.getId() == R.id.ch09_changemenu_biginer) {
			this.mBeginer = true;
			invalidateOptionsMenu();
		} else {
			this.mBeginer = false;
			invalidateOptionsMenu();
		}
	}
}
